|
ARD2
1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
|
00001 /****************************************************************************** 00002 * 00003 * Freescale Semiconductor Inc. 00004 * (c) Copyright 2004-2011 Freescale Semiconductor 00005 * ALL RIGHTS RESERVED. 00006 * 00007 ****************************************************************************/ 00025 #ifndef __FREEMASTER_H 00026 #define __FREEMASTER_H 00027 00028 /* identify our current platform */ 00029 #define FMSTR_PLATFORM_MPC56xx 1 00030 00031 /* FreeMASTER configuration */ 00032 #include "freemaster_defcfg.h" 00033 00034 /***************************************************************************** 00035 * Global types 00036 ******************************************************************************/ 00037 00038 typedef unsigned char* FMSTR_ADDR; /* CPU address type (4bytes) */ 00039 typedef unsigned short FMSTR_SIZE; /* general size type (at least 16 bits) */ 00040 typedef signed long FMSTR_BOOL; /* general boolean type */ 00041 00042 /* application command-specific types */ 00043 typedef unsigned char FMSTR_APPCMD_CODE; 00044 typedef unsigned char FMSTR_APPCMD_DATA, *FMSTR_APPCMD_PDATA; 00045 typedef unsigned char FMSTR_APPCMD_RESULT; 00046 00047 /* pointer to application command callback handler */ 00048 typedef FMSTR_APPCMD_RESULT (*FMSTR_PAPPCMDFUNC)(FMSTR_APPCMD_CODE,FMSTR_APPCMD_PDATA,FMSTR_SIZE); 00049 00050 /***************************************************************************** 00051 * TSA-related user types and macros 00052 ******************************************************************************/ 00053 00054 #include "freemaster_tsa.h" 00055 00056 /***************************************************************************** 00057 * Constants 00058 ******************************************************************************/ 00059 00060 /* application command status information */ 00061 #define FMSTR_APPCMDRESULT_NOCMD 0xff 00062 #define FMSTR_APPCMDRESULT_RUNNING 0xfe 00063 #define MFSTR_APPCMDRESULT_LASTVALID 0xf7 /* F8-FF are reserved */ 00064 00065 /* recorder time base declaration helpers */ 00066 #define FMSTR_REC_BASE_SECONDS(x) ((x) & 0x3fff) 00067 #define FMSTR_REC_BASE_MILLISEC(x) (((x) & 0x3fff) | 0x4000) 00068 #define FMSTR_REC_BASE_MICROSEC(x) (((x) & 0x3fff) | 0x8000) 00069 #define FMSTR_REC_BASE_NANOSEC(x) (((x) & 0x3fff) | 0xc000) 00070 00071 #ifndef NULL 00072 #define NULL ((void *) 0) 00073 #endif 00074 /***************************************************************************** 00075 * Global functions 00076 ******************************************************************************/ 00077 00078 /* FreeMASTER serial communication API */ 00079 FMSTR_BOOL FMSTR_Init(void); /* general initiazlation */ 00080 void FMSTR_Poll(void); /* polling call, use in SHORT_INTR and POLL_DRIVEN modes */ 00081 void FMSTR_Isr(void); /* SCI/FlexCAN interrupt handler for LONG_INTR and SHORT_INTR modes */ 00082 00083 /* Recorder API */ 00084 void FMSTR_Recorder(void); 00085 void FMSTR_TriggerRec(void); 00086 void FMSTR_SetUpRecBuff(FMSTR_ADDR nBuffAddr, FMSTR_SIZE nBuffSize); 00087 00088 /* Application commands API */ 00089 FMSTR_APPCMD_CODE FMSTR_GetAppCmd(void); 00090 FMSTR_APPCMD_PDATA FMSTR_GetAppCmdData(FMSTR_SIZE* pDataLen); 00091 FMSTR_BOOL FMSTR_RegisterAppCmdCall(FMSTR_APPCMD_CODE nAppCmdCode, FMSTR_PAPPCMDFUNC pCallbackFunc); 00092 00093 void FMSTR_AppCmdAck(FMSTR_APPCMD_RESULT nResultCode); 00094 void FMSTR_AppCmdSetResponseData(FMSTR_ADDR nResultDataAddr, FMSTR_SIZE nResultDataLen); 00095 00096 #endif /* __FREEMASTER_H */ 00097